<%@ include file="/common/taglibs.jsp"%>

<head>
    <title><fmt:message key="pictureNewsDetail.title"/></title>
    <meta name="heading" content="<fmt:message key='pictureNewsDetail.heading'/>"/>
</head>

<c:set var="delObject" scope="request"><fmt:message key="pictureNewsList.pictureNews"/></c:set>
<script type="text/javascript">var msgDelConfirm =
   "<fmt:message key="delete.confirm"><fmt:param value="${delObject}"/></fmt:message>";
</script>

<div class="span2">
    <h2><fmt:message key="pictureNewsDetail.heading"/></h2>
    <fmt:message key="pictureNewsDetail.message"/>
</div>

<div class="span7">
    <s:form id="pictureNewsForm" action="savePictureNews" method="post" validate="true" cssClass="well form-horizontal" enctype="multipart/form-data">
    	<s:hidden key="pictureNews.id"/>
        <s:select name="pictureNews.news.id" list="newsList" listKey="id" listValue="title" required="true" label="News"></s:select>
        <fieldset class="control-group">
    	<label class="control-label">  </label>
    	<div class="controls">
    			<a href="editNews?id=<c:out value="${pictureNews.news.id}"/>">View News</a>
    	</div>
		</fieldset>
		 <c:if test="${empty pictureNews.id}">
         <s:file label="Add file" name="picture"/>
        </c:if>
         <c:if test="${not empty pictureNews.id}">
        <s:textfield key="viewPictureName" required="true" maxlength="10000" label="PictureNews:"/>
     	<fieldset class="control-group">
    	<label class="control-label">  </label>
    	<div class="controls">
    	<img src="/picturenews/<c:out value="${viewPictureName}"/>" />
    	</div>
		</fieldset>
         </c:if>

        <div id="actions" class="form-actions">
            <s:submit type="button" cssClass="btn btn-primary" method="save" key="button.save" theme="simple">
                <i class="icon-ok icon-white"></i> <fmt:message key="button.save"/>
            </s:submit>
            <c:if test="${not empty pictureNews.id}">
                <s:submit type="button" cssClass="btn btn-warning" method="delete" key="button.delete"
                    onclick="return confirmMessage(msgDelConfirm)" theme="simple">
                    <i class="icon-trash icon-white"></i> <fmt:message key="button.delete"/>
                </s:submit>
            </c:if>
            <s:submit type="button" cssClass="btn" method="cancel" key="button.cancel" theme="simple">
                <i class="icon-remove"></i> <fmt:message key="button.cancel"/>
            </s:submit>
        </div>
    </s:form>
</div>

<script type="text/javascript">
    $(document).ready(function() {
        $("input[type='text']:visible:enabled:first", document.forms['pictureNewsForm']).focus();
    });
</script>
